package edu.gdin.ecommerce.util;

import java.util.Map;

import com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter;

public class DoubleConverter extends DefaultTypeConverter {

	@SuppressWarnings({ "rawtypes" })
	@Override
	public Object convertValue(Map context, Object value, Class toType) {
		// System.out.println(toType);
		if (Double.class == toType) {
			String[] params = (String[]) value;
			String doubleStr = params[0];
			Double d = Double.parseDouble(doubleStr);
			return d;
		} else if (String.class == toType) {
			return value.toString();

		}
		return null;
	}

}
